<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>05_DOM操作2</title>
</head>
<body>
<input type="text" id="i1">
<input type="text" id="i2">
<button onclick="f1()">按钮1</button>
<hr>
<h3>我是标题:<span class="s">666</span></h3>
<button onclick="f2()">按钮2</button>
<script>
    function f2() {
        let spanE = document.querySelector('.s');
        spanE.innerHTML = '范<mark>传</mark>奇';
        console.log(spanE);
    }
    function f1() {
        let input1 = document.querySelector('#i1');
        let input2 = document.getElementById('i2');
        //输入框中的值都是字符串类型, 需要转换为数字类型才可以进行计算
        console.log(input1.value, input2.value,typeof input1.value);
        console.log(parseInt(input1.value) + parseInt(input2.value));
    }
</script>
</body>
</html>